package com.qc.toutiao.web;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.qc.toutiao.services.CategoryService;
import com.qc.toutiao.services.impl.CategoryServiceImpl;

public class NewsServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		CategoryService categoryService = new CategoryServiceImpl();

		// 分页条件查询新闻

		
		// 查询新闻类别
		List<Map<String, Object>> categoryList = categoryService.findCategoryAll();
		
		//封装数据
		request.setAttribute("categoryList", categoryList);
		
		//页面跳转
		request.getRequestDispatcher("jsp/home.jsp").forward(request, response);

	}

}
